﻿@model FashionShop.Models.Customer
@{
    int n = ViewBag.Products != null ? ViewBag.Products.Count : 0;
    ViewBag.Title = "Giỏ hàng (" + n.ToString() + ") sản phẩm";
    
}

<div class="kn-left">
    @Html.Partial("Elements/Advertise")

</div>
<div class="kn-main">
    <h3 style="padding:5px; margin:0;">Giỏ hàng của bạn</h3>
    <div class="kn-panel-bottom-line"> </div>
   
   @if(ViewBag.Products != null){
    
       <h3 style="color:#c83a3a">Tổng số tiền: @ViewBag.TotalPrice.ToString("N0")</h3>
        foreach(FashionShop.Models.Product product in ViewBag.Products){
            string img = "/Content/img/product/" + product.ProductID + ".jpg";
            
       
            <div class="product-block">
                <div class="product-image">
                    <a href="/san-pham/@product.ProductID/@product.URL"><img src="@img"/></a>
                </div>
                <div class="product-title">
                    <a href="/san-pham/@product.ProductID/@product.URL">@product.Name</a>
                </div>
                <div class="product-price">
                    @if(product.SalePrice < product.Price){
                        <del>@product.Price.ToString("N0")</del>@product.SalePrice.ToString("N0") <span>đ</span>
                    }else{
                        @product.SalePrice.ToString("N0") <span>đ</span>
                    }
                 </div>
        <a href="@Url.Action("RemoveFromCart", new { controller = "Customer", id = product.ProductID})" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span>Remove</a>
        </div>
        }

   }else{
       <br />
        <div class="alert alert-info">
            <b>Bạn chưa có sản phẩm nào trong giỏ!</b>
        </div>
   }
    @if(ViewBag.Products != null){
            <div class="clearfix"></div> 
       using (Html.BeginForm()) {
            @Html.ValidationSummary(true)
            <fieldset>
        <legend class="small-input">Thông tin khách hàng</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.Fullname)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Fullname, new { @class = "form-control small-input", @placeholder = "Nhập fullname"})
            @Html.ValidationMessageFor(model => model.Fullname)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Email)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Email,new { @class = "form-control small-input", @placeholder = "Nhập email"})
            @Html.ValidationMessageFor(model => model.Email)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.PhoneNumber)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.PhoneNumber, new { @class = "form-control small-input", @placeholder = "Nhập SĐT"})
            @Html.ValidationMessageFor(model => model.PhoneNumber)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Address)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Address, new { @class = "form-control small-input", @placeholder = "Nhập địa chỉ"})
            @Html.ValidationMessageFor(model => model.Address)
        </div><br />
                <p>
            <input class="btn btn-info" type="submit" value="Đặt hàng" />
        </p>
                </fieldset>
       
       }
    }
</div>
